package com.example.demo.RabbitMQTest;

import com.example.demo.RabbitMQTest.entity.QueueMessage;
import com.example.demo.RabbitMQTest.util.MQConstant;
import com.example.demo.common.service.IMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RabbitMQOne {

    @Autowired
    static IMessageService messageService;

    public static void main(String[] args) throws Exception {

        //获得订单关闭时间（2分钟）
        int closeSecond = 2 * 60;

        //发送延时消息
        QueueMessage queueMessage = new QueueMessage(MQConstant.QUEUE_HELLO_NAME, 123456 + "_" + 1);
        queueMessage.setType(2);
        queueMessage.setSeconds(closeSecond);
        messageService.send(queueMessage);
    }
}
